package principle.singleresponsibility;

/**
 * 单一职责原则演示
 *  在方法上遵循单一职责原则，只有类中方法数量足够少，可以在方法级别保持单一职责原则
 * @author Fengdong.Duan
 * @create 2023/11/7 9:51
 */
public class SingleResponsibility3 {
    public static void main(String[] args) {
        Vehicle2 vehicle = new Vehicle2();
        vehicle.waterRun("轮船");
        vehicle.airRun("飞机");
        vehicle.roadRun("自行车");
    }
}

class Vehicle2 {
    public void waterRun(String vehicle) {
        System.out.println(vehicle + "在水上运行");
    }

    public void roadRun(String vehicle) {
        System.out.println(vehicle + "在公路上运行");
    }

    public void airRun(String vehicle) {
        System.out.println(vehicle + "在天空上运行");
    }
}
